<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>t Statement (Tempo Statement)</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="ScoregensTop.html" title="Score Statements and GEN Routines" />
    <link rel="prev" href="s.html" title="s Statement" />
    <link rel="next" href="v.html" title="v Statement" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">t Statement (Tempo Statement)</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="s.html">Prev</a> </td>
          <th width="60%" align="center">Score Statements and GEN Routines</th>
          <td width="20%" align="right"> <a accesskey="n" href="v.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="t"></a>
      <div class="titlepage"></div>
      <a id="IndexTStatement" class="indexterm"></a>
      <a id="IndexTempoStatement" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">t Statement (Tempo Statement)</span>
        </h2>
        <p>t — 
      Sets the tempo.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp212892464"></a>
        <h2>Description</h2>
        <p>
      This statement sets the tempo and specifies the accelerations and decelerations for the current section. This is done by converting beats into seconds.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp212893792"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>t</strong></span>  p1  p2  p3  p4 ... (unlimited)</pre>
      </div>
      <div class="refsect1">
        <a id="idp212895792"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>p1</em></span> -- Must be zero.
    </p>
        <p>
      <span class="emphasis"><em>p2</em></span> -- Initial tempo on beats per minute.
    </p>
        <p>
      <span class="emphasis"><em>p3, p5, p7,...</em></span> -- Times in beats (in non-decreasing order).
    </p>
        <p>
      <span class="emphasis"><em>p4, p6, p8,...</em></span> -- Tempi for the referenced beat times.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp212899952"></a>
        <h2>Performance</h2>
        <p>
      Time and Tempo-for-that-time are given as ordered couples that define points on a "tempo vs. time" graph. (The time-axis here is in beats so is not necessarily linear.) The beat-rate of a Section can be thought of as a movement from point to point on that graph: motion between two points of equal height signifies constant tempo, while motion between two points of unequal height will cause an accelarando or ritardando accordingly. The graph can contain discontinuities: two points given equal times but different tempi will cause an immediate tempo change.
    </p>
        <p>
      Motion between different tempos over non-zero time is inverse linear. That is, an accelerando between two tempos M1 and M2 proceeds by linear interpolation of the single-beat durations from 60/M1 to 60/M2.
    </p>
        <p>
      The first tempo given must be for beat 0.
    </p>
        <p>
      A tempo, once assigned, will remain in effect from that time-point unless influenced by a succeeding tempo, i.e. the last specified tempo will be held to the end of the section.
    </p>
        <p>
      A <span class="emphasis"><em>t statement</em></span> applies only to the score section in which it appears. Only one <span class="emphasis"><em>t statement</em></span> is meaningful in a section; it can be placed anywhere within that section. If a score section contains no <span class="emphasis"><em>t statement</em></span>, then beats are interpreted as seconds (i.e. with an implicit <span class="emphasis"><em>t 0 60</em></span> statement).
    </p>
        <p>
      N.B. If the CSound command includes a <a class="link" href="CommandFlags.html#FlagsMinusLowerT"><em class="citetitle">-t flag</em></a>, the interpreted tempo of all score <span class="emphasis"><em>t statements</em></span> will be overridden by the command-line tempo.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp212908336"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the t statement. It uses the file <a class="ulink" href="examples/t.csd" target="_top"><em class="citetitle">t.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp212910192"></a>
          <p class="title">
            <strong>Example 1084. Example of the t statement.</strong>
          </p>
          <div class="example-contents">
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac     <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if RT audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o t.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1

<span class="oblock">instr</span> 1

aenv <span class="opc">expseg</span> .01, p3<span class="op">*</span>0.25, 1, p3<span class="op">*</span>0.75, 0.01
asig <span class="opc">poscil3</span> .8<span class="op">*</span>aenv, p4, 1
     <span class="opc">outs</span> asig, asig

<span class="oblock">endin</span>
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">f</span> 1 0 16384 10 1	<span class="comment">;sine wave</span>

<span class="stamnt">t</span> 0 240 12 30 15 240	<span class="comment">;start tempo = 240 </span>
		
<span class="stamnt">i</span> 1 0 2 110		<span class="comment">;tempo = 240</span>
<span class="stamnt">i</span> 1 3 2 220		<span class="comment">;slow down &amp;</span>
<span class="stamnt">i</span> 1 6 2 440		<span class="comment">;slow down &amp;</span>
<span class="stamnt">i</span> 1 9 2 880		<span class="comment">;slow down &amp;		</span>
<span class="stamnt">i</span> 1 12 2 110		<span class="comment">;slow down to 30 at 12 seconds</span>
<span class="stamnt">i</span> 1 15 2 220		<span class="comment">;speed up to 240 again</span>
<span class="stamnt">i</span> 1 18 2 440		<span class="comment">;stay at tempo 240</span>
<span class="stamnt">i</span> 1 21 2 880
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="s.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="ScoregensTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="v.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">s Statement </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> v Statement</td>
        </tr>
      </table>
    </div>
  </body>
</html>
